import { NextRequest } from 'next/server';
import { AlbumDetailType } from '@/types/album';

const albumList: AlbumDetailType[] = [
    { id: '1', src: "https://i.imgs.ovh/2025/08/21/h4oSL.jpeg", alt: "相册图片1", title: "相册图片1", description: "这是第一张相册图片的描述", date: "2025-01-21" },
    { id: '2', src: "https://i.imgs.ovh/2025/08/21/h4JXn.jpeg", alt: "相册图片2", title: "相册图片2", description: "这是第二张相册图片的描述", date: "2025-01-21" },
    { id: '3', src: "https://i.imgs.ovh/2025/08/21/h44Dx.jpeg", alt: "相册图片3", title: "相册图片3", description: "这是第三张相册图片的描述", date: "2025-01-21" },
    { id: '4', src: "https://i.imgs.ovh/2025/08/21/h4EhM.jpeg", alt: "相册图片4", title: "相册图片4", description: "这是第四张相册图片的描述", date: "2025-01-21" },
    { id: '5', src: "https://i.imgs.ovh/2025/08/21/h4ljr.jpeg", alt: "相册图片5", title: "相册图片5", description: "这是第五张相册图片的描述", date: "2025-01-21" },
    { id: '6', src: "https://i.imgs.ovh/2025/08/21/h4t5h.jpeg", alt: "相册图片6", title: "相册图片6", description: "这是第六张相册图片的描述", date: "2025-01-21" },
    { id: '7', src: "https://i.imgs.ovh/2025/08/21/h4Kde.jpeg", alt: "相册图片7", title: "相册图片7", description: "这是第七张相册图片的描述", date: "2025-01-21" },
    { id: '8', src: "https://i.imgs.ovh/2025/08/21/h4I7a.jpeg", alt: "相册图片8", title: "相册图片8", description: "这是第八张相册图片的描述", date: "2025-01-21" },
    { id: '9', src: "https://i.imgs.ovh/2025/08/21/h4hzt.jpeg", alt: "相册图片9", title: "相册图片9", description: "这是第九张相册图片的描述", date: "2025-01-21" },
    { id: '10', src: "https://i.imgs.ovh/2025/08/21/h4GHq.jpeg", alt: "相册图片10", title: "相册图片10", description: "这是第十张相册图片的描述", date: "2025-01-21" },
    { id: '11', src: "https://i.imgs.ovh/2025/08/21/h4mwC.jpeg", alt: "相册图片11", title: "相册图片11", description: "这是第十一张相册图片的描述", date: "2025-01-21" },
];

export async function GET(
    request: NextRequest,
    { params }: { params: { id: string } }
) {
    const { id } = params;
    // 查找指定ID的图片
    const albumDetail = albumList.find(album => album.id === id);
    
    if (!albumDetail) {
        return Response.json(
            { error: '图片未找到' },
            { status: 404 }
        );
    }
    
    return Response.json(albumDetail);
}
